package com.masterclient.app.modules.firstpager;


import android.support.v4.app.Fragment;
import android.support.v4.app.FragmentManager;
import android.support.v4.app.FragmentStatePagerAdapter;
import android.view.ViewGroup;

import java.util.List;

/**
 * 主页fragment适配器
 */
public class HomeFragmentPagerAdapter extends FragmentStatePagerAdapter {
	private List<Fragment> list;
    String[] titles;
    public HomeFragmentPagerAdapter(FragmentManager fm, List<Fragment> list) {
        super(fm);
        this.list = list;

    }

    public void setTitles(String[] titles) {
        this.titles = titles;
    }

    @Override
    public CharSequence getPageTitle(int position) {
        return titles[position];
    }

    @Override
    public int getCount() {  
        return list.size();  
    }  
      
    @Override
    public Fragment getItem(int arg0) {
        return list.get(arg0);  
    }
	@Override
	public Object instantiateItem(ViewGroup arg0, int arg1) {

		return super.instantiateItem(arg0, arg1);
	}
	@Override
	 public void destroyItem(ViewGroup container, int position, Object object) {
	   super.destroyItem(container, position, object);       
	 }
}
